In [1]:
import numpy as np
import matplotlib.pyplot as pl
import seaborn as sn
import pymilne
import pylte
%matplotlib inline

Milne-Eddington synthesis


In [2]:
lambda0 = 6301.5080
JUp = 2.0
JLow = 2.0
gUp = 1.5
gLow = 1.833
lambdaStart = 6300.8
lambdaStep = 0.03
nLambda = 50

lineInfo = np.asarray([lambda0, JUp, JLow, gUp, gLow, lambdaStart, lambdaStep])

s = pymilne.milne(nLambda, lineInfo)


stokes = np.zeros((4,nLambda))

BField = 100.0
BTheta = 20.0
BChi = 20.0
VMac = 2.0
damping = 0.0
B0 = 0.8
B1 = 0.2
mu = 1.0
VDop = 0.085
kl = 5.0
modelSingle = np.asarray([BField, BTheta, BChi, VMac, damping, B0, B1, VDop, kl])

In [22]:
stokes = s.synth(modelSingle,mu)
wl = np.arange(nLambda)*lambdaStep + lambdaStart

In [26]:
f, ax = pl.subplots(ncols=2, nrows=2, figsize=(12,10))
ax = ax.flatten()
labels = ['I/I$_c$','Q/I$_c$','U/I$_c$','V/I$_c$']
for i in range(4):
    ax[i].plot(wl, stokes[i,:])
    ax[i].set_xlabel('Wavelength [$\AA$]')
    ax[i].set_ylabel(labels[i])
    ax[i].ticklabel_format(useOffset=False)
pl.tight_layout()


Local thermodynamical equilibrium


In [17]:
atmos = np.loadtxt('hsra.model', skiprows=2)
lines = np.loadtxt('lines.dat')

In [18]:
f, ax = pl.subplots(nrows=1, ncols=2, figsize=(10,6))
ax[0].plot(atmos[:,0],atmos[:,1])
ax[1].plot(atmos[:,0],atmos[:,2])
ax[0].set_xlabel('Optical depth')
ax[0].set_ylabel('Temperature [K]')
ax[1].set_xlabel('Optical depth')
ax[1].set_ylabel('Velocity [km/s]')
pl.tight_layout()



In [28]:
wl = np.linspace(6301.0,6303.0,100)
pylte.initAtmos(atmos)
pylte.initLines(lines, wl)

In [29]:
out, continuum = pylte.synthLines(atmos)

In [30]:
f, ax = pl.subplots(ncols=2, nrows=2, figsize=(12,10))
labels = ['I/I$_c$','Q/I$_c$','U/I$_c$','V/I$_c$']
loop = 0
for i in range(2):
    for j in range(2):
        ax[i,j].plot(wl, out[loop,:] / continuum)
        ax[i,j].set_xlabel('Wavelength [$\AA$]')
        ax[i,j].set_ylabel(labels[loop])
        ax[i,j].ticklabel_format(useOffset=False)
        loop += 1
pl.tight_layout()



In [ ]: